
package oreilly.command.control;

/**
 * 模擬將車庫門打開<br>
 * <br>
 * Copyright: Copyright (c) 2002-2007<br>
 * Company: E885 有限公司
 * 
 * @author Eric Gau(gau168.gau@msa.hinet.net)
 * @version 1.0
 */
public class GarageDoorOpenCommand implements Command
{
	/**
	 * 車庫門實體
	 */
	private GarageDoor garageDoor;

	/**
	 * constructor
	 * 
	 * @param garageDoor 車庫門實體
	 */
	public GarageDoorOpenCommand( GarageDoor garageDoor )
	{
		this.garageDoor = garageDoor;
	}

	/**
	 * class 為 open command, 所以按執行時, 會打開車庫門
	 * 
	 * @see Command#execute()
	 */
	public void execute()
	{
		garageDoor.up();
	}

	/**
	 * 和 <code>execute()</code> 相反, 關閉車庫門
	 * 
	 * @see Command#undo()
	 */
	public void undo()
	{
		garageDoor.down();
	}
}
